package com.kang.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kang.bean.Type;
import com.kang.commons.util.ValidationUtil;
import com.kang.mapper.TypeMapper;
import com.kang.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: service
 * @description: 类别服务实现
 * @author: K.faWu
 * @create: 2022-03-29 10:01
 **/

@Service
public class TypeServiceImpl extends ServiceImpl<TypeMapper, Type> implements TypeService {
    @Autowired
    private TypeMapper typeMapper;


    @Override
    public List<Type> queryAllType() {
        return typeMapper.queryAllType();
    }

    @Override
    public void add(Type type) {
        ValidationUtil.validate(type);
        typeMapper.insert(type);
    }
}
